package com.lufan.data.entity;

import com.google.gson.annotations.SerializedName;
import lombok.Data;

import java.util.List;
import java.util.stream.Collectors;

@Data
public class VideoStreamInfoEntity {

    private String from;
    private String result;
    private String message;
    private int quality;
    private String format;
    private long timelength;
    private String accept_format;
    @SerializedName("accept_description")
    private List<String> acceptDescription;
    @SerializedName("accept_quality")
    private List<Integer> acceptQuality;
    private int video_codecid;
    private String seek_param;
    private String seek_type;
    private Dash dash;

    public List<String> getVideoBaseUlr() {
        return dash.getVideoUrl();
    }
    public List<String> getAudioBaseUlr() {
        return dash.getAudioUrl();
    }
}

// Dash 实体类
@Data
class Dash {
    private int duration;
    @SerializedName("minBufferTime")
    private double minBufferTime;
    @SerializedName("min_buffer_time")
    private double minBufferTimeAlt;
    private List<Video> video;
private List<Audio>audio;
    public List<String> getVideoUrl() {
        return video.stream()
                .map(Video::getBaseUrl)
                .collect(Collectors.toList());
    }

    public List<String> getAudioUrl() {
        return audio.stream()
                .map(Audio::getBaseUrl)
                .collect(Collectors.toList());
    }
}

// Video 实体类
@Data
class Video {
    private int id;
    @SerializedName("baseUrl")
    private String baseUrl;
}
@Data
class Audio {
    private int id;
    @SerializedName("baseUrl")
    private String baseUrl;
}

